/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.me.stepapp.server;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Peter
 */
@Entity
@Table(name = "STEPAPP_USER")
@NamedQueries({
    @NamedQuery(name = "StepappUser.findAll", query = "SELECT s FROM StepappUser s"),
    @NamedQuery(name = "StepappUser.findById", query = "SELECT s FROM StepappUser s WHERE s.id = :id"),
    @NamedQuery(name = "StepappUser.findByName", query = "SELECT s FROM StepappUser s WHERE s.name = :name"),
    @NamedQuery(name = "StepappUser.findByNumber", query = "SELECT s FROM StepappUser s WHERE s.number = :number"),
    @NamedQuery(name = "StepappUser.findByPassword", query = "SELECT s FROM StepappUser s WHERE s.password = :password")})
public class StepappUser implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "ID")
    private Integer id;
    @Column(name = "NAME")
    private String name;
    @Column(name = "NUMBER")
    private String number;
    @Column(name = "PASSWORD")
    private String password;
    @ManyToMany(mappedBy = "stepappUserList")
    private List<StepappLocation> stepappLocationList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "stepappUser")
    private List<StepappFriend> stepappFriendList;

    public StepappUser() {
    }

    public StepappUser(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public List<StepappLocation> getStepappLocationList() {
        return stepappLocationList;
    }

    public void setStepappLocationList(List<StepappLocation> stepappLocationList) {
        this.stepappLocationList = stepappLocationList;
    }

    public List<StepappFriend> getStepappFriendList() {
        return stepappFriendList;
    }

    public void setStepappFriendList(List<StepappFriend> stepappFriendList) {
        this.stepappFriendList = stepappFriendList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof StepappUser)) {
            return false;
        }
        StepappUser other = (StepappUser) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.me.stepapp.server.StepappUser[id=" + id + "]";
    }

}
